package com.atiguigu.spring6.validator.four;

import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
import org.springframework.stereotype.Component;

public class CannotBlackValidation implements ConstraintValidator<CannotBlack, String> {
    @Override
    public void initialize(CannotBlack constraintAnnotation) {
        ConstraintValidator.super.initialize(constraintAnnotation);
    }

    @Override
    public boolean isValid(String s, ConstraintValidatorContext constraintValidatorContext) {
        if (s != null && s.contains(" ")) {
            return false;
        }
        return false;
    }
}
